import axios from "axios";
export const getGoodsFromAPI = async (filterObject: { name: string; platform: string; sortType: string; categoriesId: number }, getGoodsLink: string, goods: any, loadMoreGoods: () => void) => {
  try {
    const response = await axios.post(getGoodsLink, filterObject, {
      headers: {
        'Content-Type': 'application/json',
      },
    });
    if (response.data.data.length === 0) {
      throw new Error('找不到该商品');
    }

    goods.value = response.data.data;
    loadMoreGoods();
  } catch (error) {
    console.error('Error fetching goods:', error);
    throw error;
  }
};

